<?php
session_start();
if(DEBUG_MODE == 'on')
{	
	error_reporting(E_ALL ^ E_NOTICE);	
}
elseif(DEBUG_MODE == 'off')
{	
	error_reporting(0);	
}

date_default_timezone_set('Asia/Bangkok');

include(PUNG_ROOT . '/system/class/db.class.php');
include(PUNG_ROOT . '/system/class/tpl.class.php');
include(PUNG_ROOT . '/system/functions.php');
include(PUNG_ROOT . '/system/language.php');

$db = new DB(DB_HOST, DB_USER, DB_PASS, DB_NAME);

/*
 * Main theme variables
 */

$assigned = array();
$themeroot = PUNG_URL . '/templates/' . THEME;
$themefile = PUNG_ROOT . '/templates/' . THEME . '/theme.html';
$pagetitle = stripslashes(constant('PAGETITLE'));
$sitename = stripslashes(constant('SITENAME'));
$additional = '';
$encoding = constant('ENCODING');
$footer = stripslashes(constant('FOOTER'));
$slogan = stripslashes(constant('SLOGAN'));
$keywords = stripslashes(constant('KEYWORDS'));
$description = stripslashes(constant('DESCRIPTION'));
$date = date('d.m.Y');
$time = date('H:i:s');
$content = '';
$bodytag = '';
$rss = '';
$cplink = PUNG_URL . '/admin';

/*
 * Template parser start
 */

$tpl = new Template;
$tpl -> open_template('pungcms', $themefile);

/*
 * Left blocks
 */

$lblocks = $db -> db_query("SELECT * FROM " . DB_PREFIX . "blocks WHERE position = 'left' AND visible = 'yes' ORDER BY height ASC");
$lblocks = $db -> db_result();

$tpl -> parse_loop('pungcms', 'lblocks');

/*
 * Right blocks
 */

$rblocks = $db -> db_query("SELECT * FROM " . DB_PREFIX . "blocks WHERE position = 'right' AND visible = 'yes' ORDER BY height ASC");
$rblocks = $db -> db_result();

$tpl -> parse_loop('pungcms', 'rblocks');


?>